package elven.d.common.log;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * log生产工厂，线程安全
 * @author liuyongyuan
 */
public class LogFactory {

	private volatile static LogFactory logFactory = null;
	private static final Logger log = LoggerFactory.getLogger("d");
	private LogFactory(){};
	
	public static LogFactory instance(){
		if(logFactory == null){
			synchronized (LogFactory.class) {
				if(logFactory == null){
					logFactory = new LogFactory();
				}
			}
		}
		return logFactory;
	}
	
	@SuppressWarnings("rawtypes")
	public Logger config(Class clazz){
		return LoggerFactory.getLogger(clazz);
	}
	
	public Logger config(String name){
		return LoggerFactory.getLogger(name);
	}
	
	/**
	 * default log
	 * @return
	 */
	public static Logger d(){
		return log;
	}
}